import os
import wsgiref.handlers

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template

class MainPage(webapp.RequestHandler):
    def get(self):
        template_values = {
            'login_url': users.create_login_url(self.request.uri),
            'logout_url': users.create_logout_url(self.request.uri),
            'current_user': users.get_current_user()
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/index2.html')
        self.response.out.write(template.render(path, template_values))
		
class UnitTest(webapp.RequestHandler):
    def get(self):
		
        path = os.path.join(os.path.dirname(__file__), '../templates/unit_test.html')
        self.response.out.write(template.render(path, None))

application = webapp.WSGIApplication([
    ('/', MainPage),
	('/test', UnitTest),
    ], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
